﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using TImSdk;

namespace TimSdkTestDemo
{
    class Program
    {
        [STAThread]
        static void Main(string[] args)
        {
            try
            {
                var sss=Tools.GetConfigSetting<List<Message>>(Environment.CurrentDirectory + "\\ConvInfo.json");
                //byte[] bytes = Encoding.Default.GetBytes("鎴戞槸alours");

                //var myString = Encoding.UTF8.GetString(bytes);

                //var result = TImSdkService.GetInstance.InitTImSdk();
                //Console.WriteLine($"InitTImSdk:{JsonConvert.SerializeObject(result)}");
                //if (result.Code ==0)
                //{
                //    var version = TImSdkService.GetInstance.GetTIMGetSDKVersion();
                //    Console.WriteLine("version:" + version);
                //    var loginResult = TImSdkService.GetInstance.Login("13047558100");
                //    Console.WriteLine($"loginResult:{JsonConvert.SerializeObject(loginResult)}");
                //    //while (true)
                //    //{
                //    //    var read = Console.ReadKey();
                //    //    if (read.Key == ConsoleKey.Enter)
                //    //    {
                //    //        var unResult = TImSdkService.UnInitTImSdk();
                //    //        Console.WriteLine($"UnInitTImSdk:{JsonConvert.SerializeObject(unResult)}");

                //    //    }
                //    //    Thread.Sleep(1000);
                //    //    break;
                //    //}
                //    Console.ReadLine();
                //    var unResult = TImSdkService.GetInstance.UnInitTImSdk();
                //    Console.WriteLine($"UnInitTImSdk:{JsonConvert.SerializeObject(unResult)}");

                //}
            }
            catch (Exception ex)
            {
                //Console.WriteLine(ex.Message);
                //var unResult = TImSdkService.GetInstance.UnInitTImSdk();
                //Console.WriteLine(unResult);
            }

        }
    }
}
